package com.irishud.hudnavi;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;

import com.irishud.NaviNative.NaviIface;
import com.irishud.hudnavi.wifi.WifiStatusService;

public class MainActivity extends Activity {
    String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        final String TAG = "MainActivity";
        super.onCreate(savedInstanceState);
        final Button btnExit;


        //This is Test!
        //0209 fanyp added
        NaviIface.myTest();

        setContentView(R.layout.activity_main);

        if(BuildConfig.PRODUCT.contains("dw21")){
            launch_AR_apk();
            Intent intent = new Intent(MainActivity.this,NaviFloatWindowService.class);
            startService(intent);
            finish();
        }

        if(BuildConfig.PRODUCT.equals("x3")){
            Intent intent = new Intent(MainActivity.this,x3SimpleNaviActivity.class);
            startActivity(intent);

            Intent intent1= new Intent(MainActivity.this,CommService.class);
            startService(intent1);

            Intent intent2= new Intent(MainActivity.this,WifiStatusService.class);
            startService(intent2);
            finish();
        }
    }

    void launch_AR_apk(){
        try {
            android.util.Log.e(TAG,"boot Ar apk.....");
            Intent intent = new Intent(Intent.ACTION_VIEW);
            ComponentName componentName =
                    new ComponentName("org.sjtu_dalab.windshield_ar",
                            "com.unity3d.player.UnityPlayerActivity");//这个没问题
            intent.setComponent(componentName);
            startActivity(intent);
        }catch (Exception e){
        }
    }
}
